<template>
	<view>
		<!-- 轮播图 -->
		<swiper autoplay="true" indicator-dots="true" circular="true" style="height: 352upx;">
			<swiper-item v-for="(img,key) in res.data.M1582705451621.data" :key="key">
				<image :src="img.imgurl" style="height: 352upx;width: 100%;" model="aspectFill" />
			</swiper-item>
		</swiper>
		
		<!-- notice  公告-->
		<view class="uni-swiper-msg" style="padding: 12upx;width: 726upx; background-color: #FFFFFF;">
			<view class="uni-swiper-msg-icon" style="width: 70upx;">
				<view style="color: #b25415;padding-left: 10upx;">热点</view>
			</view>
			<image src="../../static/notification.png" style="width: 32upx;height: 32upx;margin-top: 10upx;margin-right: 12px;"
			 mode=""></image>
			<swiper vertical="true" autoplay="true" circular="true" interval="3000" class="flex">
				<swiper-item v-for="(item, index3) in res.data.M1582705514834.data" :key="index3">
					<navigator style="font-size: 24upx;" class="ellipsis-1" v-cloak>{{item.title}}</navigator>
				</swiper-item>
			</swiper>
		</view>
		
		<view class="uni-list">
			<view class="uni-list-cell">
				<view class="uni-list-cell-navigate uni-navigate-right" style="height: 80upx;">
					<text class="text" style="color: #FF0000;">免费区</text>
					<uni-badge :text="res.favorite" type="danger" v-if="res.favorite > 0"></uni-badge>
				</view>
			</view>
		</view>
		
		<!-- goods 商品主题场列表-->
		<view v-for="(item,i) in res.data.M1582705509827.data" :key="i" class="item">
			 <!-- @click="jumpgoods" :data-id='item.gid' -->
			<image class="triangle" :src="item.thumb"></image>
			<view class="detail">
				<view class="name">{{item.title}}</view>
				<!-- <view class='productprice' v-if="res.params.showproductprice == 1" :style="{color:res.style.productpricecolor}" v-cloak>{{res.params.productpricetext}}{{item.productprice}}</view> -->
				<!-- <view class='sale' v-if="res.params.showsales == 1" :style="{color:res.style.salescolor}" v-cloak>{{res.params.salestext}}{{item.sales}}</view> -->
				<view class="price webkit">
					 <!-- :style="{color:res.style.pricecolor}" -->
					<text style="font-size: 24upx;" class="flex" v-cloak>¥{{item.price}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				res:[],
				openid:'',
				
			};
		},
		onLoad:function(){
			uni.showLoading()
			uni.getStorage({
				key: 'openid',
				success: (res) => {
					this.openid = res.data
					this.setAjax()
				},
				fail: () => {
					uni.navigateTo({
						url: '../../login/login'
					});
				}
			});
		},
		methods:{
			setAjax(){
				uni.request({
					url: this.$BASE_URL+'/index.php?i=2&c=entry&m=ewei_shopv2&do=mobile&r=diypage&app=1&id=26',
					success: res => {
						console.log(res)
						this.res = res
					},
					fail: () => {},
					complete: () => {}
				});
				uni.hideLoading()
			},
			jump(e){
				uni.navigateTo({
					url: e.currentTarget.dataset.src
				});
			},
		}
	}
</script>

<style>
	.triangle {
		width: 100%;
		height: 346upx;
		display: block;
	}
	.one .triangle {
		height: 714upx
	}
	.three .triangle {
		height: 224upx
	}
	.detail {
		background: #fff;
		padding: 20upx 12upx;
	}
	.name {
		height: 68upx;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
		font-size: 24upx;
		line-height: 36upx;
	}
	.item {
		float: left;
		width: 50%;
		padding: 10upx;
		box-sizing: border-box;
	}
	
	.one .item {
		width: 100%;
	}
	
	.three .item {
		width: 33.33%;
	}
	.uni-list-cell.active {background:#f5f5f5;}
	.uni-list image {width:34upx;height:34upx;}
	.uni-list .text {position:absolute;left:84upx;font-size:30upx;color: #444;}
	.uni-list {margin-top:20upx;border-radius: 15upx;}
	.uni-list:before,.uni-list:after {display:none;}
	.uni-list-cell:after {content:" ";position:absolute;left:0.5rem;right:0.5rem;bottom:-1px;height:1px;border-top:1px solid #ebebeb;color:#D9D9D9;-webkit-transform-origin:0 0;-ms-transform-origin:0 0;transform-origin:0 0;-webkit-transform:scaleY(0.5);-ms-transform:scaleY(0.5);transform:scaleY(0.5);background:none;}
	.uni-list-cell .right {font-size:24upx;color:#999;margin-right:20upx;}
	.uni-list .uni-list-cell:last-child:after {border:0;}
	.uni-list .uni-badge {margin-right:15px;background-color:#f55;}
	.nav {padding-top:40upx;background:#fff;margin-top:-40upx;}
	.nav .top {border-bottom:1px solid #f5f5f5;}
	.nav .top .uni-list {margin:0;}
</style>


